{include file="common/header.tpl"}
{if $AppUI->id <= 0}
	{include file="index/login.tpl"}  
{else}
	{include file="common/menu.tpl"}
    <div class="rightColumn">
    	<div class="boxContent">
        	<div class="contentItem">
                <div class="contentItems">
                	<div class="headerTitle"><h2>Thành viên Ban Quản Trị{if isset($smarty.session.admin) && ($smarty.session.admin&1<<0) > 0} &raquo; <a href="{$smarty.const.HOST_BACKEND}index/add">Thêm mới</a>{/if}</h2></div>
                    <div class="secData">
                    	<form id="frmAdmin" name="frmAdmin" method="post" action="{$smarty.const.HOST_BACKEND}index/act" enctype="multipart/form-data">
                        	<input type="hidden" name="paction" id="paction" />
                            <input type="hidden" name="pcancelsearch" id="pcancelsearch"/>
                        	{if $arrResult}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                    	{if isset($smarty.session.admin)}
                                            {if ($smarty.session.admin&1<<4) > 0}  
                                                <input type="button" onclick="javascript:confirmPending(this.form);" value="Tạm dừng t.k" title="Tạm dừng tài khoản của thành viên BQT"/>
                                            {/if}
                                            {if ($smarty.session.admin&1<<5) > 0}
                                            	<input type="button" onclick="javascript:confirmActive(this.form);" value="Mở t.k" title="Mở tài khoản của thành viên BQT"/>
                                            {/if}
                                       	{else}
                                        	&nbsp;
                                        {/if}
                                    </div>
                                    <div class="totalPage"><strong>Tổng số: {$intTotal}</strong></div>
                                </div>
                            {/if}
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        {if $arrResult && isset($smarty.session.admin) && (($smarty.session.admin&1<<2) > 0)}
                                        	<th class="firstChild" width="30"><input type="checkbox" name="pcheckall" id="pcheckall" onclick="javascript:checkAll(this.form,'padminid[]',this.checked);"/></th>
	                                        <th>Username</th>
                                       	{else}
                                        	<th class="firstChild">Username</th>
                                        {/if}                                        
                                        <th>Họ &amp; tên</th>
                                        <th>Quyền quản trị</th>
                                        <th>Tình trạng</th>
                                        {if $arrResult && isset($smarty.session.admin) && (($smarty.session.admin&1<<2) > 0)}<th width="230">&nbsp;</th>{/if}
                                    </tr>
                                </thead>
                                <tbody>
                                    {if $arrResult}
                                        {foreach item=item from=$arrResult}
                                            <tr class="{cycle values="odd,even"}">
                                            	{if isset($smarty.session.admin) && (($smarty.session.admin&1<<2) > 0)}
                                                	<td align="center" class="firstChild">
                                                    {if $item.username != 'root'}
                                                    	<input type="checkbox" id="padminid{$item.adminid}" name="padminid[]" value="{$item.adminid}" onclick="javascript:checkOneItem(this.form, 'pcheckall')"/>
                                                   	
                                                    	<input type="hidden" id="pusername{$item.adminid}" name="pusername[{$item.adminid}]" value="{$item.username}"/>     
                                                  	{else}&nbsp;{/if}</td>
                                                	<td>{$item.username}</td>
                                               	{else}
                                                	<td class="firstChild">{$item.username}</td>
                                                {/if}
                                                <td>{$item.fullname}</td>
                                                <td>{$arrType[$item.type]}</td>
                                                <td>{if $item.status==0}Kích hoạt{else}Tạm dừng{/if}</td>
                                                {if isset($smarty.session.admin) && ($smarty.session.admin&1<<2) > 0}
                                                	<td align="center">
                                                    	{if $item.username=='root'}
                                                        	{if $AppUI->username == 'root'}
                                                            	<a href="{$smarty.const.HOST_BACKEND}index/permission?adminid={$item.adminid}">Phân quyền</a>
                                                            {else}
                                                            	Phân quyền
                                                            {/if}
                                                        {else}<a href="{$smarty.const.HOST_BACKEND}index/permission?adminid={$item.adminid}">Phân quyền</a>
                                                        {/if} | <a href="{$smarty.const.HOST_BACKEND}index/edit?adminid={$item.adminid}">Chỉnh sửa</a> | <a href="{$smarty.const.HOST_BACKEND}index/achangepass?adminid={$item.adminid}">Thay đổi mật khẩu</a></td>
                                                {/if}
                                            </tr>
                                        {/foreach}
                                    {else}
                                    {/if}
                                </tbody>
                            </table>
                            {if $arrResult}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                    	{if isset($smarty.session.admin)}
                                            {if ($smarty.session.admin&1<<4) > 0}  
                                                <input type="button" onclick="javascript:confirmPending(this.form);" value="Tạm dừng t.k" title="Tạm dừng tài khoản của thành viên BQT"/>
                                            {/if}
                                            {if ($smarty.session.admin&1<<5) > 0}
                                            	<input type="button" onclick="javascript:confirmActive(this.form);" value="Mở t.k" title="Mở tài khoản của thành viên BQT"/>
                                            {/if}
                                       	{else}
                                        	&nbsp;
                                        {/if}
                                    </div>
    								{paging total=$intTotal limit=$intLimit offset=$intOffset}
                                </div>
                            {/if}
                      	</form>
                   	</div>
                </div>
          	</div>
        </div>
    </div>
{/if}
{include file="common/footer.tpl"}
                
